import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

public class FastJson {
    public static void main(String[] args) {
    String jsonStr="{\"age\":22,\"clazz\":\"文科六班\",\"gender\":\"女\",\"id\":\"1500100001\",\"name\":\"发大厦\"}";
    //直接获取age 将json字符串转化为json对象，直接获取值
        JSONObject jsonObject = JSON.parseObject(jsonStr);
        Object age = jsonObject.get("age");
        System.out.println(age);
        //转化为自定义对象
        Student student = JSON.parseObject(jsonStr, Student.class);
        System.out.println(student.getAge());
        //对象转化为json
        String string = JSON.toJSONString(jsonObject);
        System.out.println(string);
    }
}